package edu.gyc.mysystem.dao;

import edu.gyc.mysystem.model.Permission;
import edu.gyc.mysystem.model.Role;
import edu.gyc.mysystem.vo.PermissionVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Set;

@Component
public interface PermissionMapper {
    //当只有一个参数时，dao接口的方法中可不用添加注解。Mybatis可成功匹配参数。
//当大于一个参数时，dao接口的方法中需要使用注解@Param(“XXX”)为Mybatis指定参数名称。
    Set<Permission> findPermissionsByRoleId(@Param("roles") Set<Role> roles);
    List<PermissionVo> getPermsByUid(Integer uid);

    List<Permission> getAllPerms();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Wed Mar 24 17:05:02 CST 2021
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Wed Mar 24 17:05:02 CST 2021
     */
    int insert(Permission record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Wed Mar 24 17:05:02 CST 2021
     */
    int insertSelective(Permission record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Wed Mar 24 17:05:02 CST 2021
     */
    Permission selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Wed Mar 24 17:05:02 CST 2021
     */
    int updateByPrimaryKeySelective(Permission record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table permission
     *
     * @mbg.generated Wed Mar 24 17:05:02 CST 2021
     */
    int updateByPrimaryKey(Permission record);
}